<template>
    <div class="TreatmentReview">
        <div class="Review nBox">
            <div class="h0">
                <p class="lt">治疗回顾</p>
            </div>
            <div class="czq panel-default">
                <div class="pucType2">

                    <p>
                        <a><b class="red"></b>门诊就诊</a>
                        <a><b class="purple"></b>住院就诊</a>
                        <a><b class="green"></b>检查</a>
                        <a><b class="blue"></b>检验</a>
                        <a><b class="yellow"></b>手术</a>
                    </p>
                </div>
                <div class="lists">
                    <el-calendar v-if="false">
                        <!-- 这里使用的是 2.5 slot 语法，对于新项目请使用 2.6 slot 语法-->
                        <template
                                slot="dateCell"
                                slot-scope="{date, data}">
                            <p :class="data.isSelected ? 'is-selected' : ''">
                                {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : ''}}
                                <b class="red"></b><b class="purple"></b><b class="green"></b>
                            </p>
                        </template>
                    </el-calendar>
                    <el-calendar id="calendar">
                        <template
                                slot="dateCell"
                                slot-scope="{date, data}">
                            <div class="calendar-day">{{ data.day }}</div>
                            <div class="pucType3">
                                <p v-if="handleSelected(data.day,0) == 1 ">
                                    <a><b class="red"></b></a>
                                </p>
                                <p v-if="handleSelected(data.day,1) == 1 ">
                                    <a><b class="purple"></b></a>
                                </p>
                                <p v-if="handleSelected(data.day,2) == 1 ">
                                    <a><b class="green"></b></a>
                                </p>
                                <p v-if="handleSelected(data.day,3) == 1 ">
                                    <a><b class="blue"></b></a>
                                </p>
                                <p v-if="handleSelected(data.day,4) == 1 ">
                                    <a><b class="yellow"></b></a>
                                </p>
                            </div>
                        </template>
                    </el-calendar>
                </div>
            </div>
        </div>


    </div>
</template>
<script>
    export default {
        name: "Modularinformation",
        data() {
            return {
                msg: "SystemManagement 下的 Modularinformation",
                value: new Date(),
                dataList: [
                    {
                        time: "2020-07-01",
                        isMZJZ: "1",//门诊就诊
                        isZYJZ: "1",//住院就诊
                        isJC: "0",//检查
                        isJY: "0",//检验
                        isSS: "0",//手术
                    },
                    {
                        time: "2020-07-02",
                        isMZJZ: "0",//门诊就诊
                        isZYJZ: "1",//住院就诊
                        isJC: "1",//检查
                        isJY: "1",//检验
                        isSS: "1",//手术
                    },
                    {
                        time: "2020-07-03",
                        isMZJZ: "1",//门诊就诊
                        isZYJZ: "1",//住院就诊
                        isJC: "1",//检查
                        isJY: "1",//检验
                        isSS: "1",//手术
                    }
                ]
            };
        },
        methods: {
            handleSelected(day, item) {
                let flag = -1; //默认显示为0
                console.log("日历赋值&&&&&&&&&&&&￥￥￥￥￥￥￥￥￥￥￥￥￥￥￥￥￥￥################");
                console.log(day);
                this.dataList.forEach(m => {
                    if (m.time == day) {
                        if (item == 0) {//门诊就诊
                            if (m.isMZJZ == 1) {
                                flag = 1
                            }
                        }
                        if (item == 1) {//住院就诊
                            if (m.isZYJZ == 1) {
                                flag = 1
                            }
                        }
                        if (item == 2) {//检查
                            if (m.isJC == 1) {
                                flag = 1
                            }
                        }
                        if (item == 3) {//检验
                            if (m.isJY == 1) {
                                flag = 1
                            }
                        }
                        if (item == 4) {//手术
                            if (m.isSS == 1) {
                                flag = 1
                            }
                        }
                    }
                })

                return flag
            },
            /*************************************************************/
            openDetails(row, index) {
                this.model_id = row.id;
                this.model_name = row.name;
                this.changeSelectStyle = index;
                if (this.model_XZBJ == "1") {
                    this.model_jm = row.id;
                    this.queryz();
                    this.changeSelectStyle = "0";
                    this.model_jm = "";
                }

                console.log(row);
            },
            handleChange(val) {
                console.log(val);
            },
            //主表保存
            savez() {
                if (this.model_name == "") {
                    this.$message({showClose: true, message: "模块名称不能为空！", type: "error"});
                    return;
                }
                var data = {
                    model: "11.综合维护-模块信息",
                    code: "11041",
                    input: {
                        "id": this.model_id == "" ? "1" : this.model_id,
                        "name": this.model_name
                    }
                };
                this.$post("CloudHIS/Business_Handle", data)
                    .then(res => {
                        if (res.code == 0) {
                            this.model_XZBJ = "1"
                            this.$message({message: res.msg, type: "success"});
                            this.queryz();
                            this.addMasterUser();
                            document.getElementById("2").focus();
                        } else {
                            this.$message({showClose: true, message: res.msg, type: "error"});
                        }
                    })
                    .catch(err => {
                        console.log(err);
                    });
            },
            //删除主表信息
            deletez() {
                var data = {
                    model: "11.综合维护-模块信息",
                    code: "11043",
                    input: {
                        "id": this.model_id
                    }
                };
                this.$post("CloudHIS/Business_Handle", data)
                    .then(res => {
                        if (res.code == 0) {
                            this.$message({message: res.msg, type: "success"});
                            this.queryz();
                            this.addMasterUser();
                        } else {
                            this.$message({showClose: true, message: res.msg, type: "error"});
                        }
                    })
                    .catch(err => {
                        console.log(err);
                    });
            },
            //主表查询

            queryz() {
                this.model_query = [];
                var data = {
                    model: "11.综合维护-模块信息",
                    code: "11042",
                    input: {
                        jm: this.model_jm ? this.model_jm : ""
                    }
                };
                console.log(data)
                this.$post("CloudHIS/Business_Handle", data)
                    .then(res => {
                        if (this.model_XZBJ == "1") {
                            this.model_query.push(res.data[res.data.length - 1]);
                            this.model_XZBJ = "";
                            this.changeSelectStyle = "0";
                        } else {
                            this.model_query = res.data;
                            this.addMasterUser();
                        }
                        console.log("查询结果");
                        console.log(res);
                    })
                    .catch(err => {
                        console.log(err);
                    });
            },
            submit1() {
                var ele = window.event.srcElement;
                var idcount = parseInt(ele.id) + 1;

                document.getElementById(idcount + "").focus();
            },

        },
        mounted() {

        },
        created() {
            this.msg = this.$route.query;
            console.log("接收过来的传参#############################################################################")
            console.log(this.msg)
            if (this.msg.Token != null && this.msg.Token != "") {
                console.log("设置Token")
                this.$setToken(this.msg.Token)
                this.$setItemUrl(this.msg.ItemIP)
                var loginInfor = this.msg.loginInfor;
                this.LoginInfor = JSON.parse(loginInfor);
                console.log("个人登录信息");
                console.log(this.LoginInfor);
                if (this.LoginInfor != null) {
                    this.huizhenObj.Consult.HospitalId = this.LoginInfor.HospitalId
                    this.huizhenObj.Consult.DeptId = this.LoginInfor.UserId
                    this.huizhenObj.Consult.DoctorId = this.LoginInfor.UserId
                }
            } else {
                console.log("Token为空")
                var loginInfor = localStorage.getItem('LoginInfor');
                this.LoginInfor = JSON.parse(loginInfor);
                console.log("个人登录信息");
                console.log(this.LoginInfor);
                if (this.LoginInfor == null) {
                    this.LoginInfor = {
                        SectionName: "",
                        UserName: ""
                    }
                }
            }

        }
    };
</script>

<style lang="scss">
    .TreatmentReview {
        .is-selected {
            color: #1989FA;
        }
        .pucType3{
            a {
                margin-right: 15px;
            }
          b {
                display: inline-block;
                width: 15px;
                height: 12px;
                margin-right: 5px;
            }
        }
        .Review .pucType2 {
            padding-top: 4px;
            height: 50px;
        }

        .Review .pucType2 p:first-child b {
            padding: 0 15px;
            font-weight: bold;
            font-size: 15px;
            position: relative;
            top: 2px;
        }

        .Review .pucType2 p:last-child {
            float: right;
            padding-top: 8px;
        }

        .Review .pucType2 p:last-child a {
            margin-right: 15px;
        }

        .Review .pucType2 p:last-child b {
            display: inline-block;
            width: 15px;
            height: 12px;
            margin-right: 5px;
        }

        .Review .lists {
            clear: both;
            padding: 10px 15px;
        }

        .Review .h6 {
            font-weight: bold;
            font-size: 14px;
            margin: 5px 0 10px 0;
        }

        .Review table {
            background: rgb(251, 251, 251);
        }

        .Review td {
            height: 24px;
        }

        .Review .red {
            background: red;
        }

        .Review .green {
            background: #008000;
        }

        .Review .purple {
            background: #b50bb5
        }

        .Review .blue {
            background: #0000ff
        }

        .Review .yellow {
            background: #ecec00;
        }

        .Review .table em {
            color: red;
            float: right;
            margin-top: -20px;
        }

        .Review .table b {
            display: block;
            width: 20px;
            height: 12px;
            margin: 5px 0;
        }

        /*选择平台页*/
        .IfChange {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: 100%;
            border: none;
            padding-left: 200px;
        }

        /*公共管理头部*/
        .nBox .h0 {
            height: 45px;
            padding: 6px 0 0 9px;
            border-bottom: 1px solid #d2ecff;
        }

        .nBox .h0 .lt {
            font-size: 18px;
            line-height: 32px;
            padding-left: 5px;
            color: #6bb1ec;
            font-weight: bold;
        }

        .nBox .h0 .rt {
            margin-right: 12px;
        }

        .nBox .h0 .rt .btn {
            margin-left: 5px;
        }

        .nBox .Ahead {
            height: 32px;
            line-height: 32px;
            padding: 0 15px;
            background: #ecf4ff;
            color: #0092ff;
        }

        .nBox .Ahead .btn {
            padding: 2px 12px;
            margin-top: -4px;
        }

        .nBox .Ahead i {
            color: #0092ff;
            cursor: pointer
        }

        .nBox .Tb label {
            margin: 0;
            display: block;
            cursor: pointer
        }

        .nBox .Tb label b {
            margin-right: 5px;
            float: left
        }

        .nBox .menu {
            padding: 0 10px 0 15px;
        }

        .nBox .menu dl {
            margin-bottom: 2px;
            position: relative;
        }

        .nBox .menu dl:before {
            content: '';
            border-left: 1px dashed #a4d5ff;
            height: calc(90%);
            position: absolute;
            left: 6px;
            top: 24px;
        }

        .nBox .menu dl:last-child:before {
            display: none;
        }

        .nBox .menu dt {
            line-height: 30px;
            font-weight: normal;
            color: #177ad0;
        }

        .nBox .menu label {
            margin: 0;
        }

        .nBox .menu label input {
            position: relative;
            top: 1px;
            margin-right: 5px;
        }

        .nBox .menu dt label {
            position: relative;
            margin-left: 2px;
        }

        .nBox .menu dt label:before {
            content: '';
            width: 7px;
            height: 0;
            border-bottom: 1px dashed #ddd;
            position: absolute;
            left: -8px;
            top: 14px;
        }

        .nBox .menu dd {
            margin-left: 28px;
            line-height: 24px;
            position: relative;
            cursor: pointer;
            padding-left: 16px;
        }

        .nBox .menu dd dd:hover,
        .nBox .menu dd.high {
            background: #ecf4ff;
        }

        .nBox .menu dd:before {
            content: '';
            border-left: 1px dashed #ddd;
            height: calc(100%);
            position: absolute;
            left: 0;
            top: 0;
        }

        .nBox .menu dd:after {
            content: '';
            width: 13px;
            height: 0;
            border-bottom: 1px dashed #ddd;
            position: absolute;
            right: calc(100% - 15px);
            top: 11px;
        }

        .nBox .menu dd:last-child:before {
            height: 11px;
        }

        .nBox .menu dd i {
            color: #999;
            margin-right: 6px;
            display: inline-block;
            width: 11px;
        }

        .nBox .menu dd label {
            display: block;
            cursor: pointer
        }

        .nBox .menu dd b {
            margin-left: -22px;
            position: relative;
            z-index: 2;
            top: -4px;
        }

        .nBox .menu dd dd {
            margin-left: 6px;
        }

        .nBox .menu b {
            width: 12px;
            display: inline-block;
            line-height: 12px;
            padding-top: 0;
            height: 13px;
            font-weight: normal;
            float: left;
            background-color: #73b1e7;
            margin-top: 8px;
            margin-right: 8px;
            font-size: 14px;
            border-radius: 2px;
            text-align: center;
            color: #ffffff;
            outline: none;
            border: 0;
            cursor: pointer;
        }

        /*背景弹框*/
        .blackBg {
            position: fixed;
            z-index: 999;
            background: rgba(0, 0, 0, 0.5);
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }

        .blackBg .closes {
            color: #666;
            font-size: 30px;
            position: absolute;
            right: 5px;
            top: 0;
            padding: 0 5px;
            cursor: pointer;
        }

        .blackBg .p500 {
            width: 550px;
        }

        .blackBg .p1000 {
            width: 1000px;
        }

        .pucType2 p {
            float: left;
            margin-left: 15px;
            margin-top: 5px;
        }

        .pucType3 p {
            float: left;
            margin-left: 10px;
            margin-top: 5px;
        }

        .pucType2 p span {
            background: #f6f6f6;
            height: 32px;
            float: left;
            border: 1px solid #ccc;
            margin-right: -2px;
            position: relative;
            padding-left: 5px;
            line-height: 31px;
            z-index: 2;
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }

        .pucType3 p span {
            background: #f6f6f6;
            height: 28px;
            float: left;
            border: 1px solid #ccc;
            margin-right: -2px;
            position: relative;
            padding-left: 5px;
            line-height: 27px;
            z-index: 2;
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }

        .pucType2 .form-control {
            width: 150px;
            padding: 0 5px;
        }

        .pucType3 .form-control {
            height: 28px;
            padding: 0 5px;
        }

        .pucType5 p {
            float: left;
            margin-left: 10px;
            margin-top: 5px;
        }

        .pucType5 p label {
            background: #f6f6f6;
            height: 28px;
            float: left;
            border: 1px solid #ccc;
            margin: 0 -2px 0 0;
            position: relative;
            padding-left: 5px;
            line-height: 27px;
            z-index: 2;
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }

        .pucType5 .form-control {
            height: 28px;
            padding: 0 5px;
            width: 132px;
        }

        .Tb {
            border: 1px solid #ccc;
        }

        .Tb table {
            border: none;
            margin: 0;
        }

        .Tb table th:first-child, .Tb table td:first-child {
            border-left: none;
        }

        .Tb table th:last-child, .Tb table td:last-child {
            border-right: none;
        }
    }

</style>
